package cn.com.surker.base.system.dao;

import cn.com.surker.base.system.entity.SysStorageMatch;
import cn.com.surker.dto.system.SysStorageMatchDTO;
import cn.com.surker.vo.system.SysStorageMatchVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 工控仓位对应关系表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-09-02
 */
public interface SysStorageMatchDao extends BaseMapper<SysStorageMatch> {

    IPage<SysStorageMatchVO> page(Page<SysStorageMatchVO> page, @Param("dto") SysStorageMatchDTO dto);

    List<SysStorageMatchVO> page(@Param("dto") SysStorageMatchDTO dto);

    /**
     * 根据仓位ID查询工控关联信息
     * @param storageId
     * @return
     */
    List<SysStorageMatch> findByStorageId(Long storageId);

    List<SysStorageMatch> findByStorageIdV1(String dbCode,Long storageId);

    /**
     * 验证是否有已经存在的关联关系
     * @param orgId
     * @param lineId
     * @param storageId
     * @param controlId
     * @return
     */
    Integer findExistMatch(Long orgId, Long lineId, Long storageId, Long controlId);

}
